home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / tests / repeatfault / RCS / segv.c,v < prev   
Encoding:
Text File  |  1992-07-17  |  842 b   |  58 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  srv030:1.1 srv027:1.1 srv026:1.1 srv024:1.1 srv021:1.1 srv018:1.1 srv014:1.1 srv010:1.1 srv008:1.1 srv007:1.1 srv006:1.1 srv004:1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     92.03.12.20.51.45;  author kupfer;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Test program that causes an exception and the signal handler just
  17. returns.
  18. @
  19.  
  20.  
  21.  
  22. 1.1
  23. log
  24. @Initial revision
  25. @
  26. text
  27. @/* 
  28.  * Check what happens if the handler for SIGSEGV doesn't try to correct for 
  29.  * whatever caused the signal.
  30.  *
  31.  * $Header$
  32.  */
  33.  
  34. #include <signal.h>
  35.  
  36. int ntimes = 0;
  37.  
  38. handler()
  39. {
  40.     Test_PutMessage("ding\n");
  41.     ++ntimes;
  42.     if (ntimes > 5) {
  43.     exit(1);
  44.     }
  45. }
  46.  
  47. main()
  48. {
  49.     int *bogusPtr = (int *)0x98765433;
  50.     int i;
  51.  
  52.     signal(SIGSEGV, handler);
  53.     i = *bogusPtr;
  54.     printf("i = 0x%x\n", i);
  55.     exit(0);
  56. }
  57. @
  58.